<?php
declare(strict_types=1);

namespace Zlf\Mysql\Traits;

trait Transaction
{

    /**
     * @describe 开启事务
     * @return bool
     * @user zlf zms-pro@qq.com 2025/1/18
     */
    public function beginTransaction(): bool
    {
        return $this->connect()->beginTransaction();
    }

    /**
     * @describe 提交事务
     * @return bool
     * @user zlf zms-pro@qq.com 2025/1/18
     */
    public function commit(): bool
    {
        return $this->connect()->commit();
    }

    /**
     * @describe 回滚事务
     * @return bool
     * @user zlf zms-pro@qq.com 2025/1/18
     */
    public function rollBack(): bool
    {
        return $this->connect()->rollBack();
    }
}